package com.guan.friend.controller.user;

import com.guan.common.core.baseController.BaseController;
import com.guan.common.core.constants.HttpConstants;
import com.guan.common.core.domain.R;
import com.guan.common.core.domain.TableDataInfo;
import com.guan.friend.aspect.CheckUserStatus;
import com.guan.friend.domain.exam.dto.ExamDTO;
import com.guan.friend.domain.exam.dto.ExamQueryDTO;
import com.guan.friend.service.user.IUserExamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.net.http.HttpHeaders;

@RestController
@RequestMapping("/user/exam")
public class UserExamController extends BaseController {

    @Autowired
    private IUserExamService userExamService;

    @PostMapping("/enter")
    @CheckUserStatus
    public R<Void> enter(@RequestHeader(HttpConstants.AUTHENTICATION) String token, @RequestBody ExamDTO examDTO){
       return  toR(userExamService.enter(token, examDTO));
    }

    @GetMapping("/list")
    public TableDataInfo list(ExamQueryDTO examQueryDTO){
       return userExamService.list(examQueryDTO);
    }
}
